package com.inst.jsoup_html_demo.utils;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.inst.jsoup_html_demo.R;
import com.inst.jsoup_html_demo.fragment.FollowFragment;
import com.inst.jsoup_html_demo.fragment.HomeFragment;
import com.inst.jsoup_html_demo.fragment.MineFragment;
import com.inst.jsoup_html_demo.fragment.TopicFragment;
import com.inst.jsoup_html_demo.fragment.caipuFragment.CaiPuFenLeiFragment;
import com.inst.jsoup_html_demo.fragment.caipuFragment.CaiPuHomeFragment;
import com.inst.jsoup_html_demo.fragment.caipuFragment.CaiPuShiCaiFragment;
import com.inst.jsoup_html_demo.fragment.topicfragment.HuaTiFragment;
import com.inst.jsoup_html_demo.fragment.topicfragment.JingHuaFragment;
import com.inst.jsoup_html_demo.fragment.topicfragment.ReMenFragment;
import com.inst.jsoup_html_demo.fragment.topicfragment.ZuiXinFragment;

import java.util.ArrayList;


/**
 * Created by zhouwei on 17/4/23.
 */

public class DataGenerator {

    public static final int []mTabRes = new int[]{R.drawable.tab_home_selector, R.drawable.tab_discovery_selector,R.drawable.tab_attention_selector,R.drawable.tab_profile_selector};
//    public static final int []mTabResPressed = new int[]{R.drawable.ic_tab_strip_icon_feed_selected,R.drawable.ic_tab_strip_icon_category_selected,R.drawable.ic_tab_strip_icon_pgc_selected,R.drawable.ic_tab_strip_icon_profile_selected};
    public static final String []mTabTitle = new String[]{"首页","话题","关注","我的"};

    public static Fragment[] getFragments(String from){
        Fragment fragments[] = new Fragment[4];
        fragments[0] = HomeFragment.newInstance(from);
        fragments[1] = TopicFragment.newInstance(from);
        fragments[2] = FollowFragment.newInstance(from);
        fragments[3] = MineFragment.newInstance(from);
        Log.e("DataGenerator","----主布局fragment长度"+fragments.length);
        return fragments;
    }

    public static ArrayList<Fragment> getCaipuFragments(String from){
        ArrayList<Fragment> fragments = new ArrayList<Fragment>();
        fragments.add(CaiPuHomeFragment.newInstance(from));
        fragments.add(CaiPuFenLeiFragment.newInstance(from));
        fragments.add(CaiPuShiCaiFragment.newInstance(from));
        Log.e("DataGenerator","----菜谱fragment长度"+fragments.size());
        return fragments;
    }

    public static ArrayList<Fragment> getHuaTiFragments(String from){
        ArrayList<Fragment> fragments = new ArrayList<Fragment>();
        fragments.add(HuaTiFragment.newInstance(from));
        fragments.add(ZuiXinFragment.newInstance(from));
        fragments.add(ReMenFragment.newInstance(from));
        fragments.add(JingHuaFragment.newInstance(from));
        Log.e("DataGenerator","----话题fragment长度"+fragments.size());
        return fragments;
    }

    /**
     * 获取Tab 显示的内容
     * @param context
     * @param position
     * @return
     */
    public static View getTabView(Context context,int position){
        View view = LayoutInflater.from(context).inflate(R.layout.home_tab_content,null);
        ImageView tabIcon = (ImageView) view.findViewById(R.id.tab_content_image);
        tabIcon.setImageResource(DataGenerator.mTabRes[position]);
        TextView tabText = (TextView) view.findViewById(R.id.tab_content_text);
        tabText.setText(mTabTitle[position]);
        return view;
    }
}
